
define(function(require, exports, modules) {
	'use strict';

	require('css!assets/css/loading/loading.css');

	var template = require('text!./tpl.entry.html'), 
		util = require('util');
	var View = Backbone.View.extend({
		el : '#page',
		events : {
			'click .btn-register':'register',
			'click .btn-login':'toLogin',
			'click .btn-English':'toEnglishVersion',
			'click .btn-Chinese':'toChineseVersion'
		},
		initialize : function() {
			this.template = _.template(template);
			this.render();
		},
		render : function() {
			this.$el.html(this.template());
			this.setting();
		},
		setting:function(){
			var w = $('.loading').width();
			var h = w*95/639 - 12*95/639;
			$('.loading > div').css({top: 14*w/639 +'px',height: 49*w/639 +'px'});
			$('.loadbg .loading .percent').css({top: 7-49*w/639+'px'});
			$('.loadbg .loading span').css({top: 7-98*w/639+'px'});
		},
		toLogin:function(){
			var sd = new Date(),ed = new Date();
			sd.setHours(0, 0, 0, 0);
			ed.setHours(0, 40, 0, 0);
			var d = new Date();
			if(d-sd >0 && d-ed < 0){
				$('.loadbg .note').text('00:00-00:40 是系统正在计算利率时间段，过后再登陆哟！');
				location.href="405.html";
			}else{
				Backbone.history.navigate('login',{trigger:true});
			}
		},
		register: function(){
			var sd = new Date(),ed = new Date();
			sd.setHours(0, 0, 0, 0);
			ed.setHours(0, 40, 0, 0);
			var d = new Date();
			if(d-sd >0 && d-ed < 0){
				$('.loadbg .note').text('00:00-00:40 是系统正在计算利率时间段，过后再登陆哟！');
				location.href="405.html";
			}else{
				Backbone.history.navigate('register',{trigger:true});
			}
		},
		toEnglishVersion: function(){
			location.href = 'http://www.wilfulgo.com';
		},
		toChineseVersion: function(){
			location.href = 'http://www.wilfulgo.com';
		}
	});

	return View;
});